<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/12/2
 * Time: 10:25
 */
function doUploadAction(){
    //前端以数组的方式上传图片
    if(is_array($_FILES['file']['name'])){
        $count = count($_FILES['file']['name']);
        //echo '图片数量： '.$count;
        for($i=0;$i<$count;$i++){
            move_uploaded_file($_FILES['file']['tmp_name'][$i],'public/image/'.$_FILES['file']['name'][$i]);
        }
    }else{//非数组的方式上传图片
        move_uploaded_file($_FILES['file']['tmp_name'],'public/image/'.$_FILES['file']['name']);
    }
}

doUploadAction();